<!DOCTYPE html>
<title>Test video controls visibility with multimodal input. The controls should remain visible if the last input event was a mouse move over them.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video controls loop></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.oncanplaythrough = t.step_func(function() {
        assert_true(video.paused);

        // Tap (touch input) the play button.
        var coords = elementCoordinates(enabledPlayButton(video));
        eventSender.gestureTapDown(coords[0], coords[1]);
        eventSender.gestureShowPress(coords[0], coords[1]);
        eventSender.gestureTap(coords[0], coords[1]);
        assert_false(video.paused);
        assert_true(isControlsPanelVisible(video));

        runAfterHideMediaControlsTimerFired(t.step_func_done(function() {
            // And then hover the control with the mouse.
            eventSender.mouseMoveTo(0, 0);
            eventSender.mouseMoveTo(coords[0], coords[1]);

            // And the controls should remain visible.
            runAfterHideMediaControlsTimerFired(t.step_func_done(function() {
                assert_true(isControlsPanelVisible(video));
            }), video);
        }), video);
    });

    video.src = "content/test.ogv";
});
</script>
